<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProductAttributesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('product_attributes', function (Blueprint $table) {
            $table->increments('id');

            $table->string('attr_name')->commit('属性名');
            $table->boolean('attr_type')->default(0)->commit('属性的类型;0: 唯一，1：可选');
            $table->string('attr_option_values')->nullable()->default(''); // 属性的可选值
            $table->integer('type_id');

            // $table->string('product_id')->commit('按编号，所以字符串类型');
            
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_attributes');
    }
}
